<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>switch切换按钮</title>
		<style type="text/css">
			*, *:before, *:after {
  box-sizing: border-box;
}

body {
  font-family: 'Montserrat', sans-serif;
  color: #888;
}

h1 {
  font-weight: 300;
}

.text-red {
  color: #f07464;
}

.button-toggle-wrap {
  text-align: center;
  position: absolute;
  left: 50%;
  top: 50%;
  -webkit-transform: translate(-50%, -50%);
          transform: translate(-50%, -50%);
}

.button-toggle {
  display: inline-block;
  background: #bbbbbb;
  border-radius: 3px;
  height: 48px;
  padding: 4px;
  width: 101px;
  position: relative;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.22);
}
.button-toggle .handle {
  position: absolute;
  left: 4px;
  right: auto;
  width: 40px;
  height: 40px;
  background: #fff;
  border-radius: 3px;
  -webkit-transition: all 0.4s cubic-bezier(0.33, 1.6, 0.66, 1);
  transition: all 0.4s cubic-bezier(0.33, 1.6, 0.66, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.22);
}

.toggler {
  display: none;
}
.toggler:checked + .button-toggle {
  background: #f07464;
}
.toggler:checked + .button-toggle .handle {
  left: 57px;
}

		</style>
	</head>
	<body>
		<label class="button-toggle-wrap">
  <h1 class="my-text">My life is beautiful, because...</h1>
  <input class="toggler" type="checkbox" data-toggle="button-toggle"/>
  <div class="button-toggle">
    <div class="handle">
      <div class="bars"></div>
    </div>
  </div>
</label>

<script src="../js/jquery-1.11.2.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	// non of use
$(function() {
	$("[data-toggle]").click(function() {
		var target = $(".my-text");
		if($(this).prop('checked')) {
			target.html('You are my life <span class="text-red"><3</span>');
		} else {
			target.html('My life is beautiful, because...');
		}
	})
})
</script>
	</body>
</html>
